$(function () {
	initplugin();

	//给查询按钮绑定事件
	bindButton();
})

function bindButton() {
	$("#queryButton").click(function () {
		var startTime = $('#beiginTimeOfWaterLevel').val();
		var endTime = $('#endTimeOfWaterLevel').val();
		var type = $("#alertSelect option:selected").val();
		var url = "http://localhost:8080/Waterworks/Alert/QueryAlertRecord?startTime=" + startTime + "&endTime=" + endTime + "&type=" + type;

		//jq("#allwaterplantInfoTable").bootstrapTable('load',data);
		$.getJSON(url, function (data) {
			$("#alertRecord").bootstrapTable('load', data);
			/*data = [{
		'审理时间': '2014-12-20 至 2014-12-20',
		'承办庭室': 'XXXX',
		'承办法官': 'XXX',
		'承办法院': 'XXXXXXX法院',
		'案件状态': 'XX',
		'案号': '(XXXX)XXXXXX第XXXX号'
}, {
		'审理时间': '2014-12-20 至 2014-12-20',
		'承办庭室': 'XXXX',
		'承办法官': 'XXX',
		'承办法院': 'XXXXXXX法院',
		'案件状态': 'XX',
		'案号': '(XXXX)XXXXXX第XXXX号'
}
					];
$(".fishBone").fishBone(data);*/
		});
	});
}

function initplugin() {
	$('.dateChoose').datetimepicker({

		language: 'zh-CN',
		weekStart: 0,
		todayBtn: 1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 0,
		format: 'yyyy/mm/dd',
	});

	$('.dataIn').datetimepicker({

		language: 'zh-CN',
		weekStart: 0,
		todayBtn: 1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2, //起始选择范围年
		minView: 0,
		minuteStep: 1,
		forceParse: 0,
		//format: 'yyyy/mm/dd',
		format: 'yyyy/mm/dd/hh:ii:ss'
	});

	/*Highcharts.setOptions({
	global: {
		useUTC: false
	},

	lang: {
		downloadJPEG: "另存为JPEG 图片",
		downloadPDF: "另存为PDF文档",
		downloadPNG: "另存为PNG 图片",
		downloadSVG: "另存为SVG 矢量图",
		exportButtonTitle: "导出图片",
		printChart: "打印",
		resetZoom: "重置",
		loading: "加载……",
		months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
		weekdays: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
		shortMonths: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
	},
});*/
}
//添加编辑按钮
function flagMenu(value, row, index) {
	//alert("修改前数据："+row.fluxGate);
	if(row.flag=="1"){
		return "已处理";
	}
	else{
		return "未处理";
	}

}
//编辑按钮
function optionButton(value, row, index) {
	//alert("修改前数据："+row.fluxGate);
	return [
        '<a class="like" href=',
		'"http://localhost:8080/Waterworks/Alert/DisposeAlertRecordInit?alertType=',
		row.alertType,
		'&stationnum=',
		row.stationnum,
		'&recordTime=',
		row.time,
		'&alertId=',
		row.id.alertId,
		'"title="Like">',
        '<button class="btn btn-default btn-primary ">处理</button>',
        '</a>  ',
    ].join('');
}
/*window.operateEvents = {
	'click .like': function (e, value, row, index) {
		alertId = row.alertId;
		alertType = row.alertType;
		alertContent = row.alertContent;

		$("#alertType").val(alertType);
		$("#alertContent").val(alertContent);
		if (alertId == null || alertType == null || alertContent == null) {
			alert("预警编号、预警类型、处理内容不能为无或者空");
		} else {
			$.ajax({
				url: '../Alert/UpdateAlert?alert.alertId=' + alertId + '&alert.alertType=' + alertType + '&alert.alertContent=' + alertContent,
				type: 'POST',
				data: "{}",
				dataType: 'text',
				success: function (data) {
					if (data == '"success"')
						alert("修改成功");
					else
						alert("修改失败");

				}
			});
		}
	}
};*/